/************************************************************************************************************************************************************
*                          DESENVOLVEDORES: Paulo Costa; Diogo Oliveira; Iara Fernanda; Mariana Souza
*                          ORIENTADOR e CO-DESENVOLVEDOR: Prof.Dr. Eraldo Pereira Marinho
*
*                                                           ARQUIVO: keywords.c
*
************************************************************************************************************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <keywords.h>

char *keywords[] = 
{
  "BEGIN",
  "PROGRAM",
  "PROCEDURE",
  "FUNCTION",
  "VAR",
  "INTEGER",
  "REAL",
  "IF",
  "THEN",
  "ELSE",
  "WHILE",
  "DO",
  "REPEAT",
  "UNTIL",
  "OR",
  "AND",
  "NOT",
  "MOD",
  "DIV",
  "TO",
  "DOWNTO",
  "GOTO",
  "FOR",
  "FALSE",
  "CASE",
  "CHAR",  
  "END"
};

int iskeyword(const char *symbol)
{
  token_t i;
  
  for(i=BEGIN; i <= END ; i++){   
    if(strcmp(keywords[i-BEGIN], symbol)==0)
      return i;
  }
  return 0;
}